<template>
<div class="top">
	<ul>
		<li style="font-size:38px;">购票网&nbsp&nbsp</li>
		<li style="color:#1E90FF">|&nbsp&nbsp欢迎访问</li>
		<li style="float:right; margin-top:20px; margin-right:50px;">|&nbsp&nbsp<a href="Logon.html">注册</a></li>
		<li style="float:right; margin-top:20px; margin-right:10px;" v-if="login==true"><a @click="dellogin(userName)" href="">退出</a></li>
		<li style="float:right; margin-top:20px; margin-right:10px;" v-if="login==true"><a style="color:#FFA500;">尊贵的VIP会员：{{userName}}</a></li>
		<li style="float:right; margin-top:20px; margin-right:10px;" v-else><a href="login.html">登录</a></li>
	</ul>
</div>
</template>
 
<script>
module.exports = {
    data: function() {
        return {
        	userName : '',
        	login : false
        }
    },
    mounted : function(){
    	this.seeklogin()
    },
    methods : {
    	seeklogin : function(){
    		var target = this;
    		axios.get('/common/seeklogin')
			.then(function (response){
				var success = response.data.success;
				if(success!=false){
					target.userName = response.data.result.data;
					target.login = true;
				}
			})
			.catch(function (error) {
				console.log(error);
			});
    	},
    	dellogin : function(name){
    		var target = this;
    		axios.post('/common/dellogin',{
    			adminUserName : name
    		})
			.then(function (response){
				var ss = response.data.success;
				if(ss==true){
					alert("已退出登录！");
					window.location.reload();
				}
			})
			.catch(function (error) {
				console.log(error);
			});
    	}
    }
}
</script>
 
<style>
	body,ul,li,a{
		list-style:none;
		text-decoration:none;
		padding:0px;
		margin:0px;
	}
	.top{
		background-color:#FFFFFF;
		width:auto;
		height:50px;
		padding:30px 40px;
		border-bottom:double 2px #CFCFCF;
	}
	.top ul li{
		display:inline;
		border:double 2px #FFFFFF;
	}
</style>